const joi = require('joi')
//用户名的验证规则
const username = joi.optional()
//电话号码的验证规则
const mobile = joi.string().pattern(/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/).required()
//密码的验证规则
const password = joi.string().pattern(/^[\S]{6,12}$/).required()

//定义email的验证规则
const email = joi.string().email().optional()

//注册登录表单的验证规则对象
exports.reg_login_schema = {
  //表示对req.body中的数据进行验证
  body:{
    username,
    mobile,
    password
  }
}

exports.update_userinfo_schema = {
  body:{
    username,
    email
  }
}